public class Alg2 {
    public <T extends Comparable<T>> T max(T[] array){
        T maxvalue = array[0];
        for (int i = 1; i < array.length; i++) {
            if(array[i].compareTo(maxvalue) > 0){
                maxvalue = array[i];
            }
        }
        return maxvalue;
    }
}
